package graph.group.zhangtao.guider.homepage.fragments;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import graph.group.zhangtao.guider.R;
import graph.group.zhangtao.guider.homepage.activities.ToolBarX;
import graph.group.zhangtao.guider.homepage.adapters.ProfileAdapter;

/**
 * Created by T5 on 2016/6/16.
 */
public class ProfileFragment extends ListFragment {

    FragmentActivity activity;
    Toolbar toolbar;
    TextView tv_title;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fg_profile,container,false);
        activity = getActivity();


        initToolbar(view);
        ProfileAdapter adapter = new ProfileAdapter(activity);
        setListAdapter(adapter);
        return view;
    }


    private void initToolbar(View view) {
        toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
        ToolBarX mToolbar = new ToolBarX(toolbar, (AppCompatActivity) activity);
        mToolbar.setVisibility(View.GONE);
        Toolbar newToolbar = (Toolbar) view.findViewById(R.id.toolbar_profile);
        newToolbar.setTitle("个人信息");
        newToolbar.inflateMenu(R.menu.menu_profile);
    }
}
